//
//  UIView+Line.swift
//  A-star
//
//  Created by xukai on 2018/1/8.
//  Copyright © 2018年 xukai. All rights reserved.
//

import UIKit

extension UIView
{
    func drawLineWithSpoint(sPoint:CGPoint, ePoint:CGPoint, w:CGFloat, color:UIColor)
    {

        let solidShapeLayer = CAShapeLayer()
        let solidShapePath = CGMutablePath()
        solidShapeLayer.fillColor = UIColor.clear.cgColor
        solidShapeLayer.strokeColor = color.cgColor
        solidShapeLayer.lineWidth = w
        solidShapePath.move(to: CGPoint(x: sPoint.x, y: sPoint.y))
        solidShapePath.addLine(to: CGPoint(x: ePoint.x, y: ePoint.y))
        
        solidShapeLayer.path = solidShapePath
        self.layer.addSublayer(solidShapeLayer)
    
    }
    
    
    
}
